﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data.Linq;
namespace LEANHKHOA_WPF
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        DataClasses1DataContext db = new DataClasses1DataContext();
       
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                NHACUNGCAP nc = db.NHACUNGCAPs.Single(ncc1 => ncc1.Mancc == textBox3.Text);
                textBox4.Text = nc.Mancc;
                textBox1.Text = nc.Tencc;
                textBox2.Text = nc.Dienthoai;
            }
            catch
            {
                MessageBox.Show("Không tìm thấy");
            }
        }
        public void loadform()
        {
           // dataGrid1.DataContext = db.GetTable<NHACUNGCAP>();
        }
        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            loadform();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

            LEANHKHOA_WPF.LEANHKHOA_6DataSet lEANHKHOA_6DataSet = ((LEANHKHOA_WPF.LEANHKHOA_6DataSet)(this.FindResource("lEANHKHOA_6DataSet")));
            // Load data into the table NHACUNGCAP. You can modify this code as needed.
            LEANHKHOA_WPF.LEANHKHOA_6DataSetTableAdapters.NHACUNGCAPTableAdapter lEANHKHOA_6DataSetNHACUNGCAPTableAdapter = new LEANHKHOA_WPF.LEANHKHOA_6DataSetTableAdapters.NHACUNGCAPTableAdapter();
            lEANHKHOA_6DataSetNHACUNGCAPTableAdapter.Fill(lEANHKHOA_6DataSet.NHACUNGCAP);
            System.Windows.Data.CollectionViewSource nHACUNGCAPViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("nHACUNGCAPViewSource")));
            nHACUNGCAPViewSource.View.MoveCurrentToFirst();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }
        
    }
}
